﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Web.Services;
using NS.BLL.Systems;
using NS.Model.Systems;
using NS.Utilities;
using WechatModel;
using BLL;
using WechatUtility;

public partial class Platform_WxMenu : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

        }
    }

    protected void btnReload_Click(object sender, EventArgs e)
    {
        List<W_MenuInfo> menu = new List<W_MenuInfo>();
        W_MenuInfo m1 = new W_MenuInfo { name = "预约洗车", type = WMenuType.LinkButton, url = WebConfigHelper.GetAppSet("WebUrl") + "/wechat/default.html" };
        menu.Add(m1);
        W_MenuInfo m2 = new W_MenuInfo { name = "我的", type = WMenuType.Button };
        m2.sub_button = new List<W_MenuInfo>();
        m2.sub_button.Add(new W_MenuInfo { name = "我的订单", type = WMenuType.LinkButton, url = WebConfigHelper.GetAppSet("WebUrl") + "/wechat/index.html?at=list" });
        menu.Add(m2);
        Wechat wcbll = new Wechat();
        if (wcbll.DeleteMenu())
        {
            if (wcbll.BuildMenu(menu))
            {
                Response.Write("菜单创建成功！");
            }
            else
            {
                Response.Write("菜单创建失败！");
            }
        }
        else
        {
            Response.Write("删除菜单失败！");
        }
    }
}